﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyMainSite2.Data.Repositories
{
	public class MenuRepository : IMenuRepository
	{
		#region Public Methods

		public tblMenu GetTopMenu()
		{
			var context = new MyMainSite2Entities();

			var topMenu = (from m in context.tblMenus
						   where m.Type == MenuType.Top
						   select m).FirstOrDefault();

			return topMenu;
		}

		public IList<tblMenuItem> GetMenuItemsForMenu(int menuId)
		{
			var context = new MyMainSite2Entities();

			var items = (from i in context.tblMenuItems
						 where i.MenuId == menuId
						 select i).ToList();

			return items;
		}

		#endregion
	}
}
